from django.contrib import admin

from .models import QueryLog, AuditLog,AccessTimeOutLogs,OpLogs


# Register your models here.
@admin.register(QueryLog)
class QueryLogAdmin(admin.ModelAdmin):
    list_display = ['instance_name']
    list_filter = ['instance_name']
    search_fields = ['instance_name']


@admin.register(AuditLog)
class AuditLogAdmin(admin.ModelAdmin):
    list_display = ['user_id']
    list_filter = ['user_id']
    search_fields = ['user_id']


@admin.register(OpLogs)
class OpLogsAdmin(admin.ModelAdmin):
    list_display = ['re_url', 're_method', 'access_time', 're_ip', 'user_agent', 'rp_code', 're_content', 're_time',
                    're_user',
                    ]  # rp_content 响应参数内容太多不展示
    list_filter = ('re_url', 're_user')
    search_fields = ['re_url', 're_user', 'rp_code']


@admin.register(AccessTimeOutLogs)
class AccessTimeOutLogsAdmin(admin.ModelAdmin):
    list_display = ['re_url', 're_method', 'access_time', 're_ip', 'user_agent', 'rp_code', 're_content', 're_time',
                    're_user',
                    ]  # rp_content 响应参数内容太多不展示
    list_filter = ('re_url', 're_user')
    search_fields = ['re_url', 're_user', 'rp_code']
